﻿@using Orange.Mvc4App.Models
@{
    ViewBag.Title = "客户分组";
    List<Group> groups = (List<Group>)ViewBag.Groups;
    string groupid = (string)ViewBag.Groupid;
    List<Customer> member = (List<Customer>)ViewBag.Member;
    List<Customer> nomember = (List<Customer>)ViewBag.NoMemeber;
    SelectList sll = new SelectList(groups, "Groupid", "Groupname", groupid);
}
<h2>
    客户分组</h2>
@using (Html.BeginForm("Index", "Group", FormMethod.Get)) {
    <p class="toolbar">
        @Html.ImageLink(Url.Action("Create"), Url.Content("~/Content/images/icon_add.gif"),"添加")
        @Html.ImageLink(Url.Action("Edit", new { id = groupid }), Url.Content("~/Content/images/icon-edit.gif"),"编辑")
        @Html.ImageLink(Url.Action("Details", new { id = groupid }), Url.Content("~/Content/images/icon-info.gif"),"明细")
        @Html.ImageLink(Url.Action("Delete", new { id = groupid }), Url.Content("~/Content/images/icon_del.gif"),"删除")
    </p>
    <p>
        <h3>
            当前分组
        </h3>
        @Html.DropDownList("ddlgroup", sll)
    </p>
}
@using (Ajax.BeginForm("SaveMem", "Group", new AjaxOptions {
    OnSuccess = "SaveOK", OnFailure = "SaveErr"
})) {
    <input type="submit" id="submit" name="submit" value="保存分组设置" />
    <input type="hidden" value="" name="memlist" id="memlist" />
    <input type="hidden" value="" name="selgroupid" id="selgroupid" />
}
<div class="group">
    <h3>
        组内成员
    </h3>
    <select id="selleft" size="20">
        @foreach (var item in member) {
            <option value="@item.CustomerId">@item.CustomerName</option>
        }
    </select>
</div>
<div class="group">
    <h3>
        非组内成员
    </h3>
    <select id="selright" size="20">
        @foreach (var item in nomember) { 
            <option value="@item.CustomerId">@item.CustomerName</option>            
        }
    </select>
</div>
@section css{
    <style type="text/css">
        div.group
        {
            float: left;
            clear: right;
            margin-left: 15px;
        }
        div.group select
        {
            width: 300px;
        }
        form
        {
            margin: 10px;
        }
        
        a.oper
        {
            background: none repeat scroll 0 0 gray;
            border: 1px solid black;
            color: white;
            text-decoration: none;
        }
    </style>
</style>
}
@section script{
    <script src="../../Scripts/page/group.js" type="text/javascript"></script>
}
